<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./template/LayoutPadrao.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml">
   
    <ui:define name="centro">
        <h:form id="frm1">

            <p:dataTable var="artigo" value="#{avaliacoesBean.artigos}" 
                         rowKey="#{artigo.cod}" 
                         paginator="#{avaliacoesBean.artigos.size() > 10}" 
                         rows="10"

                         id="artigosTable"
                         editable="true">



                <f:facet name="header">Artigos</f:facet>

                <p:column headerText="Título" sortBy="#{artigo.titulo}" 
                          style="width: 6%"
                          filterBy="#{artigo.titulo}">

                    <h:outputText value="#{artigo.titulo}" />

                </p:column>

                <p:column headerText="Autor" sortBy="#{artigo.autorcod.nome}"
                          filterBy="#{artigo.autorcod.nome}">                   

                    <h:outputText value="#{artigo.autorcod.nome}" />

                </p:column>

                <p:column headerText="Tema" sortBy="#{artigo.temacod.descricao}">                   

                    <h:outputText value="#{artigo.temacod.descricao}" />

                </p:column>

                <p:column headerText="Evento" sortBy="#{artigo.eventocod.descricao}">    
                    <h:outputText value="#{artigo.eventocod.descricao}"/>                        
                </p:column>

                <p:column headerText="Co-autores">                   
                    <p:selectOneMenu rendered="#{not empty artigo.autorList}" 
                                     >
                        <f:selectItem itemValue="" itemLabel="Lista" 
                                      noSelectionOption="true"/>
                        <f:selectItems value="#{artigo.autorList}" var="coautor"
                                       itemLabel="#{coautor.nome}"
                                       itemValue="#{coautor}"/>
                    </p:selectOneMenu>
                </p:column>

                <p:column style="width: 6%">
                    
                </p:column>
                <p:column style="width: 6%">
                    <h:link value="Avaliar" outcome="NovaAvaliacao?faces-redirect=true">
                        <f:param name="revisor" value="#{avaliacoesBean.revisor.cod}"/>
                        <f:param name="artigo" value="#{artigo.cod}" />
                    </h:link>
                </p:column>

                <f:facet name="footer">

                </f:facet>


            </p:dataTable>
            <p:messages closable="true" id="msg"/>
        </h:form>


    </ui:define>

</ui:composition>
